<template>
	<view class="m-order-cancel">
		<u-popup mode="bottom" border-radius="20" :closeable="true" v-model="show">
			<view class="m-popup-cancel">
				<view class="m-popup__title">
					<text>选择取消原因</text>
				</view>
				<view class="m-list">
					<view class="m-item" v-for="(item,index) in list" :key="index" @click="selectFun(item)">
						<view class="m-item__left">
							<text>{{item}}</text>
						</view>
						<view class="m-item__radio" :class="{'m-item__radio--selected':item == cancel_remarks}"></view>
					</view>
				</view>
				
								
				<view class="m-popup__bottom">
					<view class="m-popup__btn" :class="{disBtn:!cancel_remarks}" @click="cancelFun">
						<text>取消订单</text>
					</view>
					<view class="m-popup__btn m-popup__btn--extend" @click="show = false">
						<text>我再想想</text>
					</view>
				</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	export default {
		name:"m-order-cancel",
		data() {
			return {
				show:false,
				list:['行程有变化，无需入住','忘记使用优惠券','在其他APP预订当前酒店更便宜','当前酒店比周边其他酒店价格贵','酒店声称没有房间，要求取消','其他原因'],
				cancel_remarks:'',
				order_id:'',
				
				checked:false
			};
		},
		methods:{
			open(id){
				this.order_id = id
				this.show = true
			},
			selectFun(item){
				this.cancel_remarks = item
			},
			cancelFun(){
				if(!this.cancel_remarks){
					return false;
				}
				this.$emit('cancel',this.order_id,this.cancel_remarks)
				this.show = false
			}
		}
	}
</script>

<style lang="scss">
.m-order-cancel{
	.m-popup-cancel{
		.m-popup__title{
			font-size: 32rpx;
			color: #222;
			font-weight: 800;
			padding: 30rpx 0 20rpx 0;
			text-align: center;
		}
		.m-list{
			padding: 0 30rpx;
			border-bottom: 20rpx solid #f5f5f5;
			.m-item{
				display: flex;
				align-items: center;
				justify-content: space-between;
				height: 94rpx;
				.m-item__left{
					font-size: 28rpx;
					color: #222;
				}
				.m-item__radio{
					width: 36rpx;
					height: 36rpx;
					border: 2rpx solid #D7D7D7;
					border-radius: 50%;
				}
				.m-item__radio--selected{
					border: 8rpx solid #D3A358;
				}
			}
		}
		
		.m-popup-tip{
			display: flex;
			align-items: center;
			justify-content: center;
			padding: 30rpx 0;
			margin-bottom: 0rpx;
			font-size: 26rpx;
			color: #222;
			.m-popup-box{
				display: flex;
				margin-right: 10rpx;
				image{
					width: 30rpx;
					height: 30rpx;
				}
			}
		}
		
		.m-popup__bottom{
			display: flex;
			justify-content: center;
			align-items: center;
			margin-bottom: 60rpx;
			.m-popup__btn{
				display: flex;
				align-items: center;
				justify-content: center;
				width: 355rpx;
				height: 86rpx;
				border:1px solid #D3A358 ;
				font-size: 28rpx;
				color: #D3A358;
				border-top-left-radius: 45rpx;
				border-bottom-left-radius: 45rpx;
			}
			.m-popup__btn--extend{
				background: #D3A358;
				color: #fff;
				border-top-left-radius: 0rpx;
				border-bottom-left-radius: 0rpx;
				border-top-right-radius: 45rpx;
				border-bottom-right-radius: 45rpx;
			}
			.disBtn{
				color: #999;
				border: 1px solid #eee;
			}
		}
	}
	
}
</style>